# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=dnschef
pkgver=17.a395411
pkgrel=8
groups=('blackarch' 'blackarch-proxy')
pkgdesc='A highly configurable DNS proxy for pentesters.'
url='http://thesprawl.org/projects/dnschef/'
arch=('any')
license=('GPL3')
depends=('python' 'python-dnslib')
makedepends=('git')
source=("git+https://github.com/iphelix/$pkgname.git")
#source=("https://thesprawl.org/media/projects/$pkgname-$pkgver.zip")
#DLAGENTS=("https::/usr/bin/curl -k -o %o %u")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" README CHANGELOG TODO
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm LICENSE README CHANGELOG TODO

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

